import time

# 打印函数执行时间
def compputer_runtime(fn):
    def metric():
        start_time = time.time()
        fn()
        end_time = time.time()
        print('{}耗时：{:.4f}s'.format(fn.__name__,end_time - start_time))
    return metric

@compputer_runtime
def run():
    l = [x*x for x in range(1000)]
    print(l)

run()